<template>
	<view>
		<view class="banner">
			<swiper class="swiper" :style="{height: swiperH}" indicator-color="#C9E3FF" indicator-active-color="#007aff"
				indicator-dots="true" autoplay="true" interval="5000">
				<swiper-item>
					<view>
						<image class="swiper1" :style="{height: swiperH,width: swiperW}" mode="aspectFit"
							src="@/static/banner/banner1.jpg">
						</image>
					</view>
				</swiper-item>
				<swiper-item>
					<view>
						<image class="swiper1" :style="{height: swiperH,width: swiperW}" mode="aspectFit"
							src="@/static/banner/banner2.jpg">
						</image>
					</view>
				</swiper-item>
				<swiper-item>
					<view>
						<image class="swiper1" :style="{height: swiperH,width: swiperW}" mode="aspectFit"
							src="@/static/banner/banner3.jpg">
						</image>
					</view>
				</swiper-item>
			</swiper>
		</view>
		<view class="indexMenu">
			<view class="menuLi" v-for="(item,i) in menuList" :key="i">
				<view class="menuIoc">
					<span @click="tapnumeIndex(item.url)" :class="['iconfont',item.iocVal,item.iocstyle]"></span>
				</view>
				<view class="menuName">{{item.name}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuList: [{
					url: '/pages/Blue/add',
					name: '蓝牙',
					iocVal: 'icon-lanya',
					iocstyle: 'xueya'
				}],

				headPicList: [],
			}
		},
		computed: {
			swiperH: function() {
				const sys = uni.getSystemInfoSync()
				const _picw = 750 //图片的宽度
				const _pich = 361 //图片的高度
				console.log(sys)
				const _nh = Math.trunc(sys.screenWidth * _pich / _picw) + 1
				return _nh + 'px'
			},
			swiperW: function() {
				const sys = uni.getSystemInfoSync()
				return sys.screenWidth + 'px'
			}
		},
		onShow() {
		},
		onLoad() {
			this.getSysInfo()
		},
		methods: {
			getSysInfo() {
				/* const value='5a001d5b0000000000000000000000080c0018' 
				console.log(value.substring(4, 8))
				let weight = parseInt(value.substring(4, 8), 16) / 100
				let height = parseInt(value.substring(30, 34), 16) / 10
				let imp0 = value.substring(28, 30) + value.substring(34, 36)
				
				let result = height / 100
				result = result * result
				result = weight / result
				result = result.toFixed(2)
				
				console.log("您的身高是：" + height + 'cm')
				console.log("您的体重是：" + weight + 'kg')
				console.log("BMI：" + result)
				console.log("阻抗：" + parseInt(imp0, 16)) */
				
				plus.device.setWakelock(true) //屏幕常亮
			},
			tapnumeIndex(url) {
				uni.navigateTo({
					url: url
				})
			}
		}
	}
</script>

<style lang="scss">
	.swiper {}

	.swiper1 {}

	.indexMenu {
		padding-top: 40rpx;

		.menuLi {
			width: 33%;
			height: 220rpx;
			float: left;
			display: inline;
			text-align: center;
			overflow: hidden;
			font-size: 32rpx;

			.menuIoc span {
				display: inline-block;
				width: 110rpx;
				height: 110rpx;
				line-height: 110rpx;
				font-size: 60rpx;
				border-radius: 200rpx;
			}

			.menuName {
				line-height: 60rpx;
			}
		}

		.rulestyle {
			color: #B9D3F5;
			background-image: linear-gradient(to top, #004395, #1C81FF);
		}

		.niaoJI {
			color: #98FFC6;
			background-image: linear-gradient(to top, #05980A, #2CC2D5);
		}

		.xueya {
			color: #CBF0FF;
			background-image: linear-gradient(to top, #038B83, #95D1FA);
		}
	}
</style>